Vtkvolume¶
Download this notebook from GitHub (right-click to download).
import panel as pn
pn.extension('vtk')
The VTKVolume pane renders 3d volumetric data defined on regular grids. It may be constructed from a 3D NumPy array or a vtkVolume. The pane provides interactive control over the color opacity to look through the volume.
Parameters:¶
For layout and styling related parameters see the customization user guide.
object(ndarray or object): Can be a 3d numpy array or an instance ofvtkImageDataclassspacing(3-tuple): Define the distance between 2 adjacent voxels in the 3 dimensions. By default the value is (1,1,1)origin(3-tuple): Origin of the volume in the scene. By default value is (0,0,0)max_data_size(Number): Maximum data size (in MB) of the data array allowed to be passed through the websockets without subsampling. If the data exceeded this size data are downsampled using scipy if installed or by taking 1 sample on N (N choosen to have an array size smaller than max_data_size) in each dimension
The simplest way to create a VTKVolume pane is to use a 3d numpy array. The spacing is used to produced a rectangular parallelepiped instead of a cube.
import numpy as np
pn.panel(np.random.rand(100,100,100), sizing_mode='stretch_width', spacing=(3,2,1))